/*
 *   This File is Part of CuteOgre Game Engine
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *	Copyright 2010 Alexandre Pires ( c.alexandre.pires@gmail.com )
 *  Created on: 2010/09/02
 */

#ifndef WIDGET_H_
#define WIDGET_H_

#include <QString>
#include <QMap>
#include <QSize>
#include <QPoint>
#include <QRect>
#include <QRegion>
#include <QSharedPointer>

class Layout;
class GUIOverlay;

#include "Style.h"

class Widget {

	friend class Layout;

private:
	QRect mGeometry;
	bool mActive, mVisible;
	Style mStyle;
	QString mName;

protected:
	Widget ( const QString& rName = QString::null ) : mName ( rName ) {
	}

public:

	virtual ~Widget () {
	}

	inline QString getName () const {
		return mName;
	}

	inline void setName ( const QString& rName ) {
		mName = rName;
	}

	inline bool isVisible () const {
		return mVisible;
	}

	inline void setVisibility ( bool rOnOff ) {
		mVisible = rOnOff;
	}

	inline bool isEnabled () const {
		return mActive;
	}

	inline void setEnabled ( bool rOnOff ) {
		mActive = rOnOff;
	}

	inline QRect getGeometry () const {
		return mGeometry;
	}

	inline void setGeometry ( const QRect& rGeometry ) {
		mGeometry = rGeometry;
	}

	inline Style getStyle () const {
		return mStyle;
	}

	inline void setStyle ( Style rStyle ) {
		mStyle = rStyle;
	}

	virtual void validateStyle () = 0;

protected:

	virtual void render ( GUIOverlay* rLayout, const QPoint& rOffset =
			QPoint (), const QRegion& rRegion = QRegion () ) = 0;

};

typedef QSharedPointer<Widget> WidgetPtr;

#endif /* WIDGET_H_ */
